package me.lensfrex.vegetables.data;

import lombok.Data;

import java.util.Arrays;

/**
 * Vegetable的信息数据类，仅用于存储相关的数据结构
 */
@Data
public class Vegetable {
    public static final int PRICE_MIN = 0;
    public static final int PRICE_AVG = 1;
    public static final int PRICE_MAX = 2;

    private String name;
    private double[] price = new double[3];

    private String priceDate;

    public double getPrice(int priceType) {
        return price[priceType];
    }

    public void setPrice(double price, int priceType) {
        this.price[priceType] = price;
    }

    @Override
    public String toString() {
        return "{" +
                "name='" + name + '\'' +
                ", price=" + Arrays.toString(price) +
                ", priceDate='" + priceDate + '\'' +
                '}';
    }
}
